<?php
class Grid_Order_Order extends OeZend_Widget_Grid {
    public function init() {

        $collectionColumn = new OeZend_Widget_Grid_Collection_Column();

        $idColumn = new OeZend_Widget_Grid_Column('id');
        $idColumn->setFilter('Combobox');
        $idColumn->addAttribute(array('class' => 'center', 'width' => '4%'));

        $titleColumn = new OeZend_Widget_Grid_Column('full_name');
        $titleColumn->setFilter('Text');
        $titleColumn->setLabel('Customer');

        $acountColumn = new OeZend_Widget_Grid_Column();
        $acountTmp = '<a href="mailto:${email}" target="_blank">${email}</a>';
        $acountColumn->setContent(new OeZend_Widget_Grid_Column_Content_Template($acountTmp));
        $acountColumn->setLabel('Email');
        $acountColumn->setFilter('Text');

        $phoneColumn = new OeZend_Widget_Grid_Column('phone');
        $phoneColumn->setLabel('Phone');
        $phoneColumn->setFilter('Text');

        $paymentTypeColumn = new OeZend_Widget_Grid_Column('payment_type_title');
        $paymentTypeColumn->setLabel('Payment type');
        $paymentTypeColumn->setFilter('Combobox');

        $orderTypeColumn = new OeZend_Widget_Grid_Column('order_status_title');
        $orderTypeColumn->setLabel('Order status');
        $orderTypeColumn->setFilter('Combobox');

        $productColumn = new OeZend_Widget_Grid_Column('product_name');
        $productColumn->setLabel('Product');
        $link = '<a href="/product/detail/id/${product_id}" target="_blank">${product_name}</a>';
        $productColumn->setContent(new OeZend_Widget_Grid_Column_Content_Template($link));
        $productColumn->setFilter('Text');

        $productCodeColumn = new OeZend_Widget_Grid_Column('product_code');
        $productCodeColumn->setLabel('Product Code');
        $productCodeColumn->setFilter('Text');

        $productPriceColumn = new OeZend_Widget_Grid_Column('product_price_sale');
        $productPriceColumn->setLabel('Product Price');

        $orderPriceColumn = new OeZend_Widget_Grid_Column('price');
        $orderPriceColumn->setLabel('Order Price');

        $linkDeleteColumn = new OeZend_Widget_Grid_Column();
        $linkDeleteColumn->setLabel('Delete');
        $linkDelete = '<a href="/admin/order/delete/id/${id}" class="must-confirm"><i class="icon-remove"></i></a>';
        $linkDeleteColumn->setContent(new OeZend_Widget_Grid_Column_Content_Template($linkDelete));
        $linkDeleteColumn->addAttribute(array('class' => 'center', 'width' => '4%'));

        $collectionColumn->addColumns(
                  array(
                        $idColumn,
                        $titleColumn,
                        $acountColumn,
                        $phoneColumn,
                        $paymentTypeColumn,
                        $orderTypeColumn,
                        $productColumn,
                        $productCodeColumn,
                        $productPriceColumn,
                        $orderPriceColumn,
                        $linkDeleteColumn
                       ));

        $this->setCollectionColumn($collectionColumn);
    }
}


